<?php
namespace app\index\widget;
use think\Controller;
use think\Db;
use think\Request;

class Widgets extends Controller{
	
	public function top()
	{
		
		$request = Request::instance();
		//echo "当前模块名称是" . $request->module();
		$_controller = $request->controller();
		$_action = $request->action();
		$_show = 0;
		//echo $_action;
		if($_controller=='Index' && $_action == 'index'){
			$_show = 1;
		}
		$this->assign('navshow',$_show);
		$navdata = Db::table('ims_ewei_shop_category')->where('parentid=0 and uniacid=7')->order("id desc")->select();
		foreach($navdata as $k=>$v){
			$navdata[$k]['son'] = Db::table('ims_ewei_shop_category')->where("parentid={$v['id']}")->select();
		}
		//print_r($navdata);
		$this->assign('navdata',$navdata);
		return $this->fetch('widget/top');
	}
	
	public function foot()
	{
		return $this->fetch('widget/foot');
	}
}